package com.lancer.backlog.service;

import com.lancer.backlog.beans.PathDemand;
import com.lancer.backlog.beans.PathDemandResult;
import com.lancer.backlog.beans.QueryPathDemand;
import com.lancer.backlog.dao.DemandMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author jq
 * @date Created in  2020/8/25  16:06
 * @description
 */
@Service
public class DemandManageService {
    private final Logger log = LoggerFactory.getLogger(DemandManageService.class);
    @Autowired
    private DemandMapper demandMapper;

    /**
     * 获取需求列表
     * @return
     */
    public PathDemandResult getPathDemand(QueryPathDemand queryPathDemand){
        PathDemandResult result=new PathDemandResult();
        //根据查询条件获取数据总条数
        int total=demandMapper.getTotal(queryPathDemand);
        queryPathDemand.makePage(queryPathDemand.getPageNo(),queryPathDemand.getPageSize());
        //需求清单列表
        List<PathDemand> pathDemandList=demandMapper.getPathDemand(queryPathDemand);
        result.setTotalRow(total);
        result.setPathDemands(pathDemandList);

        return result;
    }
}
